Computer Science
Use the Aggregate Method, the Banker's Method, or the Physicist's Method to perform Amortized Analysis.
Dynamic array: n calls to PushBack.
- Let ci = cost of i'th insertion.
- ci = 1 + { i - 1 if i - 1 is a power of 2 OR 0 otherwise
- (Ε ni=1ci)/n
- (n + Ε⌊log2(n-1)⌋j=12j)/n
- (O (n)) / n
- O(1)
- Worst case cost is O(n). Amortized cost is O(1).
(ALGS201x)